﻿using UnityEngine;
using System.Collections;
using System;
using Unity.VisualScripting;
using UnityEngine.Playables;

namespace DragonRescue3D
{
    /// <summary>
    /// Resets the level when a mouse button is pushed on the assoicated button/collider
    /// </summary>
    public class RestartBtn : MonoBehaviour
    {
        //--------------------------------------------------------
        /// <summary>
        /// Restarts the currently loaded level
        /// </summary>
        void OnMouseDown()
        {
            //Application.LoadLevel(Application.loadedLevel);
            string videoAdid = VideData.Instance.GetVide();
            TTSDK.TTRewardedVideoAd r = AdMgr.Instance.ShowVideoAdNew(videoAdid);

            //创建激励视频关闭回调
            r.OnClose += (bol, val) =>
            {
                UnityEngine.Debug.Log("关闭广告 ，是否已经看完" + bol);
                //看完广告获得提示
                if (bol)
                {
                    Application.LoadLevel(Application.loadedLevel);
                    MaidianNew.MaidianBackCallback(" ");
                    UnityEngine.Debug.Log("广告看完");
                }
                else
                {
                    UnityEngine.Debug.Log("广告未看完");
                }
            };

            //创建报错回调  
            r.OnError += (code, errorMessage) =>
            {

                UnityEngine.Debug.Log("code: " + code + " 错误信息: " + errorMessage);
        
            };

            //展示广告（新版本必须调用，不然无法展示出来广告）
            r.Show();
        }
    }
}

#if NO_AND_ERROR
public void TEXT1() 
{
	int textNum = 1;
	if (textNum == 1) 
	{
		textNum = 2;
    }
}
public void TEXT2()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}
public void TEXT3()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT4()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT5()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT6()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT8()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT9()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT10()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT11()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT12()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT13()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT14()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT15()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT16()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}

public void TEXT17()
{
    int textNum = 1;
    if (textNum == 1)
    {
        textNum = 2;
    }
}
#endif
